package com.ijpay.service;

import com.ijpay.model.Alipay;
import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.SqlPara;

/**
 * @author Javen
 */
public class AlipayService {
	public static final AlipayService me = new AlipayService();
	private final Alipay dao = new Alipay().dao();
	
	/**
	 * 根据应用的appId查询支付配置
	 * @param appId
	 * @return
	 */
	public Alipay getAlipayByAppId(String appId){
		Kv para = Kv.by("app_id", appId);
		SqlPara sqlPara = dao.getSqlPara("alipay.getAlipayByAppId",para);
		return dao.findFirst(sqlPara);
	}
	
	/**
	 * 根据应用的appId查询支付配置
	 * @param appId
	 * @return
	 */
	public Alipay getAlipayByAliPayAppId(String appId){
		Kv para = Kv.by("app_id", appId);
		SqlPara sqlPara = dao.getSqlPara("alipay.getAlipayByAlipayAppId",para);
		return dao.findFirst(sqlPara);
	}
}
